package com.scuec.tourismwebsite.controller;

import com.scuec.tourismwebsite.entity.TodayDataOverview;
import com.scuec.tourismwebsite.service.TodayDataOverviewService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;

@RestController
@CrossOrigin
@RequestMapping("tour/v1")
public class TodayDataOverviewController {

    @Autowired
    private TodayDataOverviewService todayDataOverviewService;

    @GetMapping("/todaydata")
    public List<TodayDataOverview> selectTodayDataOverview() {
        return todayDataOverviewService.selectTodayDataOverview();
    }


    @GetMapping("todaydata/{date}")
    public TodayDataOverview selectTodayDataOverviewByDate(@PathVariable String date) {
        return todayDataOverviewService.selectTodayDataOverviewByDate(date);
    }

    @PostMapping("todaydata")
    public int insertTodayDataOverview(@RequestBody TodayDataOverview todayData) {
        return todayDataOverviewService.insertTodayDataOverview(todayData);
    }
}
//1